/*
 * tabbar路由配置
 */
export const menuTabs = () => {
  return [
    {
      name: "首页",
      active: "home-o",
      id: "1",
      path: "/pages/tabbar/home/index",
    },
    {
      name: "工作台",
      icon: {
        active: "/src/static/images/work_.png",
        inactive: "/src/static/images/work.png",
      },
      id: "2",
      path: "/pages/tabbar/workspace/index",
    },
    {
      name: "设置",
      active: "setting-o",
      id: "3",
      path: "/pages/tabbar/setting/index",
    },
  ];
};

/**
 * 图片工具函数-保证图片路径正确
 *
 */
export function toCaseImg(url: string) {
  return new URL(`../static/images/${url}.png`, import.meta.url).href;
}

/**
 * 数组去重
 */
export function unique(arr) {
  const res = new Map();
  return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
}